package cn.ekgc.system.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Getter
@Setter
@Component
@ToString
public class User {

  private long id;
  private String userName;
  private String password;
  private long age;
  private long sex;
  private long jobId;
  private long role;
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)		// 反序列化
  @JsonSerialize(using = LocalDateTimeSerializer.class)         // 序列化
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
  private LocalDateTime entryTime;
  private String phone;
  private long workStatus;
  private String address;
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)		// 反序列化
  @JsonSerialize(using = LocalDateTimeSerializer.class)         // 序列化
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
  private LocalDateTime createdTime;
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)		// 反序列化
  @JsonSerialize(using = LocalDateTimeSerializer.class)         // 序列化
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
  private LocalDateTime updatedTime;
  private String area;
}